#ifndef __CE_GFX_ITEXTURE_H__
#define __CE_GFX_ITEXTURE_H__


#include <export.h>
#include <iobject.h>
#include <asset/asset.h>
#include <gfx/enum.h>
#include <math/rect.h>

/**
 * \addtogroup graphics
 * @{
 */

/**
 * @brief Description of a texture
 */
struct ceTextureDescriptor
{
  ceRect          size;
  cePixelFormat   format;
  bool            mipMap;
  unsigned        anisotropic;
  ceWrapMode      wrapMode;
  ceFilter        filter;
};

/**
 * @brief Base interface for every texture object.
 */
struct iTexture : public ceAsset
{
  CE_ASSET_ID3('t', 'e', 'x')
	iTexture () : CE_ASSET_SUPER () { }

  virtual ceTextureType GetTextureType () const = 0;

  virtual void Bind () = 0;

};


/**
 * @brief Interface for a 2D texture object.
 */
struct iTexture2D : public iTexture
{

  virtual void SetMipMap (bool mipMap) = 0;
  virtual bool IsMipMap () const = 0;

  virtual void SetAnisotropic (unsigned anisotropic) = 0;
  virtual unsigned GetAnisotropic () const = 0;

  virtual void SetWrapMode (ceWrapMode wrapMode) = 0;
  virtual ceWrapMode GetWrapMode () const = 0;

  virtual void SetFilter (ceFilter filter) = 0;
  virtual ceFilter GetFilter () const = 0;

  virtual bool Convert (const ceTextureDescriptor& desc) = 0;

  /**
   * \brief Sets the new texture image data
   *
   * Implementations of the texture must provide the sublevels for the
   * mipmapping if the texture should provide this feature.
   */
  virtual void SetData (cePixelFormat format, void* data) = 0;
  virtual void CopyData (unsigned level, const ceRect& rect, cePixelFormat format, const void* data) = 0;

};

/** @} */

#endif /* __CE_GFX_ITEXTURE_H__ */

